import React, { Component } from 'react'

export default class Child1 extends Component {
    constructor(props){
        super(props);//强化用this可以调用props
        this.state = {
            num:9
        };
        console.log(this.props);
    }
  render() {/*  */
    return (
      <div>
        <h4>我是子组件</h4>
        <button onClick={()=>{
            this.props.onChangeNum(this.state.num);
         
        }}>修改数据</button>
        <div>接收到的数据为{this.props.num}</div>
      </div>
    )
  }
}
